And then on the controls use the following to display all the information I was looking for. Just after             
insert \"><%# DataBinder.Eval(Container.DataItem, \"Subject\").ToString() %>- <%# DataBinder.Eval(Container.DataItem, \"MostRecentPostAuthor\") %>
\"><%# DataBinder.Eval(Container.DataItem, \"Forum.Name\") %> This is all pretty similiar to the \"latest post control\" I released for 1.1, but some of the functions changed locations so that control no longer works without...", "articleBody": "So I needed to modify the way the controls on the right of the homepage were showing up. So they linked to the latest post, showed the author, and the forum that they were posted in. Here's how I did it for www.sccaforums.com, which is using 2.0Near the top of your default.aspx page addint getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; } int getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; }  int getPageNumber(int replies) {  int page = 1;  if (replies > 15)   {   page = 1 + replies /15;  }   return page; } And then on the controls use the following to display all the information I was looking for. Just after               insert - This is all pretty similiar to the \"latest post control\" I released for 1.1, but some of the functions changed locations so that control no longer works without modification." }

Community Server Latest Post Changes

Community Server Latest Post Changes

So I needed to modify the way the controls on the right of the homepage were showing up. So they linked to the latest post, showed the author, and the forum that they were posted in. Here's how I did it for www.sccaforums.com, which is using 2.0

Near the top of your default.aspx page add

int getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; } int getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; }

<script language="C#" runat="server">

 int getPageNumber(int replies)
 {
  int page = 1;
  if (replies > 15)
  {
   page = 1 + replies /15;
  }
  return page;
 }
</script>

And then on the controls use the following to display all the information I was looking for. Just after

      <ItemTemplate>
       <div class="CommonSidebarContentItem">

insert

<strong><a href="<%# ForumUrls.Instance().PostPaged((int) DataBinder.Eval(Container.DataItem, "MostRecentPostID"), getPageNumber((int)DataBinder.Eval(Container.DataItem, "replies")))%>"><%# DataBinder.Eval(Container.DataItem, "Subject").ToString() %></a>
</strong>
- <strong><%# DataBinder.Eval(Container.DataItem, "MostRecentPostAuthor") %></strong><br>
<a href="<%# ForumUrls.Instance().Forum( ((Thread) Container.DataItem).SectionID ) %>">
<%# DataBinder.Eval(Container.DataItem, "Forum.Name") %>
</a>

This is all pretty similiar to the "latest post control" I released for 1.1, but some of the functions changed locations so that control no longer works without modification.

Recent Comments

There are currently no comments. Be the first to make a comment.

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type DNNRocks in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.